package com.liujc.commonlib;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

/**
 * 类名称：CommonUtil
 * 创建者：Create by liujc
 * 创建时间：Create on 2017/10/19 18:07
 * 描述：TODO
 */
public class CommonUtil {
    public static String getVersionName(Context context){
        PackageInfo packageInfo = null;
        try {
            packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        return packageInfo.versionName;
    }
}
